package com.wander.rep.formats;

import android.annotation.SuppressLint;
import java.text.FieldPosition;
import java.text.Format;
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

@SuppressLint("SimpleDateFormat")
@SuppressWarnings("serial")
public class DateFormat extends Format {
	
	private SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm", Locale.ITALY);

	/*
	 * (non-Javadoc)
	 * @see java.text.Format#format(java.lang.Object, java.lang.StringBuffer, java.text.FieldPosition)
	 */
	@Override
	public StringBuffer format(Object obj, StringBuffer toAppendTo, FieldPosition pos) {
		long timestamp = ((Number) obj).intValue()*1000;
        Date date = new Date(timestamp-3600);
        return dateFormat.format(date, toAppendTo, pos);
	}

	/*
	 * (non-Javadoc)
	 * @see java.text.Format#parseObject(java.lang.String, java.text.ParsePosition)
	 */
	@Override
	public Object parseObject(String arg0, ParsePosition arg1) {
		// TODO Auto-generated method stub
		return null;
	}

}
